package com.xinongbest.oa.utils;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * @author lemownan
 */
public class MD5Utils {
    /**
     * md5加密处理
     *
     * @param source
     * @return
     */
    public static String md5Digest(String source) {
        return DigestUtils.md5Hex(source);
    }

    public static String md5Digest(String source, int salt) {
        char[] chars = source.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            chars[i] = (char) (chars[i] + salt);
        }
        String target = new String(chars);
        return MD5Utils.md5Digest(target);
    }
}
